package com.by.controller;

import cn.hutool.core.bean.BeanUtil;
import com.by.common.bean.PageBean;
import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.query.FreightInquiryQuery;
import com.by.service.FreightProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;

@Api(tags = "产品信息")
@RestController
@RequestMapping("/api")
public class FreightProductController extends BaseController {
    @Autowired
    FreightProductService freightProductService;
    @ApiOperation("货代询价明细")
    @PostMapping("/product/list")
    public ResultBean query(@RequestBody FreightInquiryQuery query){
        PageBean bean = freightProductService.queryByMap(BeanUtil.beanToMap(query));
        return success("货代询价明细",bean);
    }
    @ApiOperation("id查询")
    @GetMapping("/product")
    public ResultBean get(@RequestParam(required = true) Serializable customer_id){
        return success("",freightProductService.get(customer_id));
    }
}
